package com.isoft.service.tableservice;

import com.isoft.dao.tabledao.BaseCfueDao;
import com.isoft.entity.tableentity.base_cfue.BaseCfueMsg;
import com.isoft.utils.TimeFormatUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;
import java.text.ParseException;
@Service
@Slf4j
public class BaseCfueService {
    @Autowired
    private BaseCfueDao baseCfueDao;
    @Transactional
    public int insertmsg(BaseCfueMsg baseCfueMsg) throws ParseException {
        Timestamp ddtm= TimeFormatUtils.stringToTimestamp(baseCfueMsg.getBaseCfueMeta().getDdtm());
        Timestamp create_time=TimeFormatUtils.GetNowTime();
        baseCfueDao.insertMeta(create_time,ddtm,baseCfueMsg.getBaseCfueMeta());
        return baseCfueDao.insertCrft(baseCfueMsg.getBaseCfueMeta().getSeqn(),create_time,baseCfueMsg.getCrft());
    }
}
